#pragma once

namespace pktoon
{
	template <typename Derived>
	class SingletonBase
	{
	public:
		static void Initialize()
		{
			sInstance = new Derived();
		}

		static void Release()
		{
			delete (sInstance);
		}

		static Derived* Instance()
		{
			assert(sInstance);
			return sInstance;
		}
	protected:
		SingletonBase(void) {}
		virtual ~SingletonBase(void) {}
		
	protected:
		static Derived* sInstance;
	};

	template <typename Derived> Derived* SingletonBase<Derived>::sInstance = NULL;
	
}	